// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import Element from 'element-ui'
import router from './router'
import './assets/css/global.css'
import 'element-ui/lib/theme-chalk/index.css'
import Vuex from 'vuex'
import store from './vuex/store'
import dataUtils from './utils/dataUtils'
import echarts from 'echarts'
// axios
import axios from 'axios'
import 'default-passive-events'

Vue.prototype.$echarts = echarts
Vue.prototype.$dataUtils = dataUtils
// 配置请求根路径

// axios.defaults.baseURL = dataUtils.baseUrl
// 挂载到vue
// Vue.prototype.$http = axios
Vue.use(Vuex)

// axios拦截器  全局配置accessToken
axios.interceptors.request.use(config => {
  config.headers.accessToken = JSON.parse(sessionStorage.getItem('token'))
  return config
})

Vue.use(Element)
Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
